home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / MWCC03 / EXAMPLES.ZIP / MWCCDLGW.PAS < prev    next >
Pascal/Delphi Source File  |  1993-08-18  |  5KB  |  167 lines

  1. {**********************************************************************}
  2. {*                                                                    *}
  3. {*          Microworks Sample Application                                        *}
  4. {*                                                                    *}
  5. {*         for Borland Pascal v7.0 and Turbo Pascal for Windows v1.5           *}
  6. {*                                                                    *}
  7. {*     Copyright 1992-93 Jeff Franks (Microworks) Sydney, Australia.  *}
  8. {*                                                                    *}
  9. {*         You are free to use, modify, reproduce and distribute the      *}
  10. {*         Sample Files (and/or any modified version) in any way you      *}
  11. {*         find useful.                                                                *}
  12. {*                                                                    *}
  13. {**********************************************************************}
  14.  
  15. {*** Introduction
  16.  
  17.     Application    := Basic MWCC DlgWindow
  18.  
  19.     Files          := MWCCDlgW.pas and MWCCDlgW.res
  20.  
  21.     Units Required := MObjects and MWCC.dll
  22.  
  23.     Tabs           := 2
  24.  
  25.     Screen         := 800 * 600
  26.  
  27.     Date           := August, 1993.
  28.  
  29.     The TMWCCDlgWindow object is a very versatile window. The least thing it does is draw
  30.     a raised border around the client area. By changing the bitmap name or the boolean
  31.     values in the InitMainWindow method you can give the client area a BWCC or MWCC pattern,
  32.     add an SFX style frame or prevent the window from being resized. The resource file
  33.     template has a thick frame. If you don't plan to add an SFX style frame you could give
  34.     the template a modal frame or no frame.
  35.  
  36.     Warning - Don't overide any inherited methods (not listed here) without first consulting
  37.               the documentation.
  38.  
  39. ***}
  40.  
  41. program MWCCDlgW;
  42.  
  43. {$R MWCCDlgW.res}
  44.  
  45. uses WinTypes, WinProcs, MObjects,
  46.          {$IFDEF Ver15}
  47.              WObjects;
  48.          {$ELSE}
  49.              Objects, OWindows, ODialogs;
  50.          {$ENDIF}
  51.  
  52. const
  53.  
  54.     AppName : PChar = 'NewMWCCDlgWindow';
  55.  
  56. type
  57.  
  58.     PNewMWCCApplication = ^TNewMWCCApplication;
  59.     TNewMWCCApplication = object(TApplication)
  60.         procedure InitMainWindow; virtual;
  61.     end;
  62.  
  63.     PNewMWCCDlgWindow = ^TNewMWCCDlgWindow;
  64.     TNewMWCCDlgWindow = object(TMWCCDlgWindow)
  65.         constructor Init(AParent: PWindowsObject; AName, ABmp: PChar);
  66.       destructor Done; virtual;
  67.         function  GetClassName : PChar; virtual;
  68.         procedure GetWindowClass(var AWndClass: TWndClass); virtual;
  69.         procedure SetUpWindow; virtual;
  70.         procedure WMCtlColor (var Msg: TMessage); virtual wm_First + wm_CtlColor;
  71.         procedure WMPaint (var Msg: TMessage); virtual wm_First + wm_Paint;
  72.         procedure WMNCPaint (var Msg: TMessage); virtual wm_First + wm_NCPaint;
  73.         procedure WMActivate (var Msg: TMessage); virtual wm_First + wm_Activate;
  74.         procedure WMNCActivate (var Msg: TMessage); virtual wm_First + wm_NCActivate;
  75.         procedure WMActivateApp (var Msg: TMessage); virtual wm_First + wm_ActivateApp;
  76.         procedure WMGetMinMaxInfo (var Msg: TMessage); virtual wm_First + wm_GetMinMaxInfo;
  77.     end;
  78.  
  79. {********** TNewMWCCApplication **********}
  80.  
  81. procedure TNewMWCCApplication.InitMainWindow;
  82. begin
  83.     MainWindow := New(PNewMWCCDlgWindow, Init(nil, 'DlgWindow', nil));
  84. end;
  85.  
  86. {********** TNewMWCCDlgWindow **********}
  87.  
  88. constructor TNewMWCCDlgWindow.Init(AParent: PWindowsObject; AName, ABmp: PChar);
  89. begin
  90.     TMWCCDlgWindow.Init(AParent, AName, ABmp);
  91.     {IsSizeable := False;}
  92.     {SFXFrame := True;}
  93. end;
  94.  
  95. destructor TNewMWCCDlgWindow.Done;
  96. begin
  97.     TMWCCDlgWindow.Done;
  98. end;
  99.  
  100. function TNewMWCCDlgWindow.GetClassName;
  101. begin
  102.   GetClassName := AppName;
  103. end;
  104.  
  105. procedure TNewMWCCDlgWindow.GetWindowClass(var AWndClass: TWndClass);
  106. begin
  107.     TMWCCDlgWindow.GetWindowClass(AWndClass);
  108. end;
  109.  
  110. procedure TNewMWCCDlgWindow.SetUpWindow;
  111. var
  112.     X, Y, W, H: Integer;
  113. begin
  114.     TMWCCDlgWindow.SetUpWindow;
  115.     X := GetSystemMetrics(sm_CXScreen) div 4;
  116.     Y := GetSystemMetrics(sm_CYScreen) div 4;
  117.     W := GetSystemMetrics(sm_CXScreen) div 2;
  118.     H := GetSystemMetrics(sm_CYScreen) div 2;
  119.     MoveWindow(HWindow, X, Y, W, H, True);
  120.     SetWindowText(Hwindow, 'MWCC DlgWindow');
  121. end;
  122.  
  123. procedure TNewMWCCDlgWindow.WMCtlColor (var Msg: TMessage);
  124. begin
  125.     TMWCCDlgWindow.WMCtlColor(Msg);
  126. end;
  127.  
  128. procedure TNewMWCCDlgWindow.WMPaint (var Msg: TMessage);
  129. begin
  130.     TMWCCDlgWindow.WMPaint(Msg);
  131. end;
  132.  
  133. procedure TNewMWCCDlgWindow.WMNCPaint (var Msg: TMessage);
  134. begin
  135.     TMWCCDlgWindow.WMNCPaint(Msg);
  136. end;
  137.  
  138. procedure TNewMWCCDlgWindow.WMActivate (var Msg: TMessage);
  139. begin
  140.     TMWCCDlgWindow.WMActivate(Msg);
  141. end;
  142.  
  143. procedure TNewMWCCDlgWindow.WMNCActivate (var Msg: TMessage);
  144. begin
  145.     TMWCCDlgWindow.WMNCActivate(Msg);
  146. end;
  147.  
  148. procedure TNewMWCCDlgWindow.WMActivateApp (var Msg: TMessage);
  149. begin
  150.     TMWCCDlgWindow.WMActivateApp(Msg);
  151. end;
  152.  
  153. procedure TNewMWCCDlgWindow.WMGetMinMaxInfo (var Msg: TMessage);
  154. begin
  155.     TMWCCDlgWindow.WMGetMinMaxInfo(Msg);
  156. end;
  157.  
  158. {********** Main program **********}
  159.  
  160. var
  161.     MWCCApp: TNewMWCCApplication;
  162. begin
  163.   MWCCApp.Init(AppName);
  164.   MWCCApp.Run;
  165.   MWCCApp.Done;
  166. end.
  167.